import testNapi from 'libentry.so'
import worker, {ThreadWorkerGlobalScope, MessageEvents} from '@ohos.worker';

let workerPort: ThreadWorkerGlobalScope = worker.workerPort;

workerPort.onmessage = (e: MessageEvents): void => {
  switch (e.data.type as number) {
    case 0:
      testNapi.createThreadSafeFunction("testWorkerThreadSafe", (value1: string, value2: string) => {
        // console.log("result: ", (value1 + value2));
        return (value1 + value2);
      })
  }
}
